package com.thougtful.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author yushun
 * @createTime 2022/10/18 - 11:15
 **/
@Getter
@AllArgsConstructor
public enum SerializationTypeEnum {

    KYRO((byte) 0x01, "kryo"),
    ;

    private final byte code;

    private final String name;

    public static String getName(byte code) {
        for (SerializationTypeEnum typeEnum :SerializationTypeEnum.values()){
            if (typeEnum.getCode() == code) {
                return typeEnum.getName();
            }
        }
        return null;
    }

}
